package com.sfj.system.enums;

/**
 * 问题整改状态枚举
 * @author kaka
 * @Date 2025/07/01
 */
public enum ProblemStatusEnum {
    /**
     * 未整改
     */
    NOT_RECTIFIED("notRectified", "未整改"),
    /**
     * 已驳回
     */
    REJECT("reject", "已驳回"),
    /**
     * 待复核
     */
    PENDING_REVIEW("pendingReview", "待复核"),
    /**
     * 已整改
     */
    RECTIFIED("rectified", "已整改");

    private final String code;
    private final String description;

    ProblemStatusEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据code获取枚举
     */
    public static ProblemStatusEnum getByCode(String code) {
        for (ProblemStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    /**
     * 检查code是否有效
     */
    public static boolean isValid(String code) {
        return getByCode(code) != null;
    }
}
